#include "Error.h"
#include "tree/SourceReader.h"

const QString Error::EFileOpenError = "File open error '%1'";
const QString Error::EStringConstNotFinished = "String constant is not finished";
const QString Error::EUnxepectedCharInName = "Unexpected character in name";
const QString Error::ENameRequired = "Name of identifier is required";
const QString Error::EInvalidNameStart = "Name must begins with letter or '_' characters";
const QString Error::EInvalidLengthOfConst = "Invalid length of character constant";
const QString Error::EInvalidCharInConst = "Unexpected newline or invalid char in constant";
const QString Error::EUnsupportedDirective = "Directive %1 is not supported";
const QString Error::EInvalidModifier = "Token '%1' is not valid token for this place";

Error::Error(SourceReader* pReader, QString pMessage)
	: FileName(pReader->FileName), Line(pReader->Line()), Column(pReader->Col()), Message(pMessage)
{
}

Error::Error(Token* pToken, QString pMessage)
	: FileName(pToken->Reader->FileName), Line(pToken->Line), Column(pToken->Col), Message(pMessage)
{
}

Error::Error(QString pFileName, qint32 pLine, qint32 pCol, QString pMessage)
	: FileName(pFileName), Line(pLine), Column(pCol), Message(pMessage)
{
}
